pkgname=fish
pkgver=3.2.1
pkgrel=1
epoch=
pkgdesc="a smart and user-friendly command line shell"
arch=('i686' 'x86_64')
url="https://fishshell.com/"
license=('GPL')
groups=()
depends=('bc' 'gcc-libs' 'gettext' 'libiconv' 'libpcre2_16' 'man-db' 'ncurses')
makedepends=('doxygen' 'gcc' 'gettext-devel' 'intltool' 'libiconv-devel' 'ncurses-devel' 'pcre2-devel' 'cmake')
optdepends=('python: for manual page completion parser and web configuration tool')
install=fish.install
source=("https://github.com/fish-shell/fish-shell/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.xz"{,.asc}
        config.fish
        msys2.fish
        msystem.fish
        perlbin.fish)
sha256sums=('d8e49f4090d3778df17dd825e4a2a80192015682423cd9dd02b6675d65c3af5b'
            'SKIP'
            '983c3273e0249957ed6c40785e005739da30f31d4f029383f257f9990d38811a'
            '2a66474cc0aa632c173ec7d5f33a6b9166d09cb58e3bccc1996bff9ee24e75bc'
            '6c1477bc62facee8353da85e8e7c967c5be33cffe2cd068bdffad381fbc17b48'
            'b136a9fa94abf53e302f7a1cc28def03b58dd2326990c5f02ceb4988341a5ac6')
validpgpkeys=('003837986104878835FA516D7A67D962D88A709A') # David Adam <zanchey@gmail.com>

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  mkdir -p build && cd build
  cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_SYSCONFDIR=/etc \
    -DCMAKE_BUILD_TYPE=Release \
    ..

  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}/build"
  backup=('etc/fish/config.fish' 'etc/fish/msys2.fish' 'etc/fish/perlbin.fish')
  rm -rf "${srcdir}/${pkgname}-${pkgver}/build/user_doc"
  make DESTDIR="${pkgdir}" install
  install -D -m644 "${srcdir}/config.fish" "${pkgdir}/etc/fish/config.fish"
  install -D -m644 "${srcdir}/msys2.fish" "${pkgdir}/etc/fish/msys2.fish"
  install -D -m644 "${srcdir}/msystem.fish" "${pkgdir}/etc/fish/msystem.fish"
  install -D -m644 "${srcdir}/perlbin.fish" "${pkgdir}/etc/fish/perlbin.fish"
}
